package com.docchatlink.constant;

import lombok.Getter;

/**
 * <p>
 * 文件解析类型
 * </p>
 *
 * @author Mr.piggy
 * @since 2024/3/27
 */
@Getter
public enum ParseTypeCodeEnum {

    AUTO("AUTO", "服务端智能判断是否需要走OCR"),
    TEXT("TEXT", "直接读取文件文本内容"),
    OCR("OCR", "强制走OCR，目前仅pdf、word支持"),
    ;

    private String code;

    private String desc;

    ParseTypeCodeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }


    public static ParseTypeCodeEnum findByCode(String code) {
        for (ParseTypeCodeEnum statusEnum : ParseTypeCodeEnum.values()) {
            if (statusEnum.getCode().equals(code)) {
                return statusEnum;
            }
        }
        return null;
    }
}
